const connecton = require('../app/database');

class AuthSerivce {
  async checkResource (tableName, id, userId) {
    try {
      const statement = `SELECT * FROM ${tableName} WHERE id = ? AND user_id = ?;`;
      const [result] = await connecton.execute(statement, [id, userId]);
      return result.length === 0 ? false : true;
    } catch (err) {
      console.log(err, "err");
    }
  }
}

module.exports = new AuthSerivce();